#include "SingleListNode.h"

void Test_PushFront()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 1);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 4);

	SLTPrint(plist);

	SLTDestory(&plist);
}

void Test_PushBack()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 4);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 1);

	SLTPushBack(&plist, 5);
	SLTPushBack(&plist, 6);

	SLTPrint(plist);

	SLTDestory(&plist);
}

void Test_PopFront()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 4);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 1);

	SLTPushBack(&plist, 5);
	SLTPushBack(&plist, 6);

	SLTPopFront(&plist);

	SLTPrint(plist);

	SLTDestory(&plist);
}

void Test_PopBack()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 4);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 1);

	SLTPushBack(&plist, 5);
	SLTPushBack(&plist, 6);

	SLTPopFront(&plist);

	SLTPopBack(&plist);

	SLTPrint(plist);

	SLTDestory(&plist);
}

void Test_Find()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 4);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 1);

	SLTPushBack(&plist, 5);
	SLTPushBack(&plist, 6);

	SLTNode* pos = SLTFind(plist, 3);
	if (pos)
	{
		printf("%d\n", pos->data);
	}

	SLTDestory(&plist);
}

void Test_Modify()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 4);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 1);

	SLTPushBack(&plist, 5);
	SLTPushBack(&plist, 6);

	SLTNode* pos = SLTModify(plist, 3, 30);
	if (pos)
	{
		SLTPrint(plist);
	}

	SLTDestory(&plist);
}

void Test_Insert()
{
	SLTNode* plist = NULL;

	SLTPushFront(&plist, 4);
	SLTPushFront(&plist, 3);
	SLTPushFront(&plist, 2);
	SLTPushFront(&plist, 1);

	SLTPushBack(&plist, 5);
	SLTPushBack(&plist, 6);

	SLTNode* pos = SLTFind(plist, 4);
	if (pos)
	{
		SLTInsert(&plist, pos, 40);
	}

	SLTPrint(plist);

	SLTDestory(&plist);
}


int main()
{
	//Test_PushFront();
	//Test_PushBack();
	//Test_PopFront();
	//Test_PopBack();
	//Test_Find();
	//Test_Modify();
	//Test_Insert();

	return 0;
}